/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AddSearchWizard.java
 *
 * Created on Sep 22, 2011, 1:55:54 PM
 */
package gtd;

import java.awt.event.ItemEvent;
import java.util.Arrays;
import java.util.Comparator;
import javax.swing.DefaultComboBoxModel;
import it.cnr.imaa.essi.lablib.gui.checkboxtree.CheckboxTree;
import javax.swing.tree.TreePath;

/**
 *
 * @author d
 */
public class AddSearchWizard extends javax.swing.JDialog {

    private int currentStep = 0;
    private IOController ioController;
    private CheckboxTree checkboxTree;
    
    /** Creates new form AddSearchWizard */
    public AddSearchWizard(java.awt.Frame parent, boolean modal) {
        // Assign to panel
        super(parent, modal);
        // Initialize gui
        initComponents();
        // Hide the finish button
        this.jbtnFinish.setVisible(false);
        // Set the window position
        this.setLocationRelativeTo(parent);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpnlContainer = new javax.swing.JPanel();
        jpnlStart = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jpnlStep1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jcboSearchType = new javax.swing.JComboBox();
        jpnlStep2 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jTextArea1 = new javax.swing.JTextArea();
        jpnlStep3 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jcboCategory = new javax.swing.JComboBox();
        jcboSubCategory = new javax.swing.JComboBox();
        jpnlStep4 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jspTreeContainer = new javax.swing.JScrollPane();
        jpnlStep5 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jTextArea2 = new javax.swing.JTextArea();
        jpnlNavigation = new javax.swing.JPanel();
        jbtnPrevious = new javax.swing.JButton();
        jbtnNext = new javax.swing.JButton();
        jbtnFinish = new javax.swing.JButton();
        jbtnCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jpnlContainer.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpnlContainer.setLayout(new java.awt.CardLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel1.setText("Welcome to the New Search wizard!");

        jLabel2.setText("This wizard will assist you in creating a new search or group object.");

        javax.swing.GroupLayout jpnlStartLayout = new javax.swing.GroupLayout(jpnlStart);
        jpnlStart.setLayout(jpnlStartLayout);
        jpnlStartLayout.setHorizontalGroup(
            jpnlStartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStartLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnlStartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addContainerGap(158, Short.MAX_VALUE))
        );
        jpnlStartLayout.setVerticalGroup(
            jpnlStartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStartLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(jLabel2)
                .addContainerGap(209, Short.MAX_VALUE))
        );

        jpnlContainer.add(jpnlStart, "card4");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel3.setText("Step 1. Name and Type");

        jLabel4.setText("Please enter a name for this search:");

        jLabel5.setText("Please select the type of search:");

        jLabel6.setText("Note:  Single search - Stand alone search.  Group search - Groups many single searches together.");

        jcboSearchType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Single", "Group" }));

        javax.swing.GroupLayout jpnlStep1Layout = new javax.swing.GroupLayout(jpnlStep1);
        jpnlStep1.setLayout(jpnlStep1Layout);
        jpnlStep1Layout.setHorizontalGroup(
            jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addGroup(jpnlStep1Layout.createSequentialGroup()
                        .addGroup(jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(18, 18, 18)
                        .addGroup(jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jcboSearchType, 0, 278, Short.MAX_VALUE)
                            .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jpnlStep1Layout.setVerticalGroup(
            jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addGroup(jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnlStep1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jcboSearchType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE)
                .addComponent(jLabel6)
                .addContainerGap())
        );

        jpnlContainer.add(jpnlStep1, "card2");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel11.setText("Finished!");

        jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
        jTextArea1.setColumns(20);
        jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 11));
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setTabSize(4);
        jTextArea1.setText("I have gathered all the information I need for a Group search.  You may add single searches to this group search from the search list.");
        jTextArea1.setWrapStyleWord(true);
        jTextArea1.setBorder(null);
        jTextArea1.setMinimumSize(new java.awt.Dimension(80, 14));
        jTextArea1.setPreferredSize(new java.awt.Dimension(80, 70));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTextArea1, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTextArea1, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jpnlStep2Layout = new javax.swing.GroupLayout(jpnlStep2);
        jpnlStep2.setLayout(jpnlStep2Layout);
        jpnlStep2Layout.setHorizontalGroup(
            jpnlStep2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnlStep2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel11))
                .addContainerGap())
        );
        jpnlStep2Layout.setVerticalGroup(
            jpnlStep2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addGap(18, 18, 18)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jpnlContainer.add(jpnlStep2, "card5");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel7.setText("Step 2. Search Information");

        jLabel8.setText("Please enter the search keywords:");

        jLabel9.setText("Please select the category:");

        jLabel10.setText("Please select the sub category:");

        jcboCategory.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jcboCategoryItemStateChanged(evt);
            }
        });

        jcboSubCategory.setEnabled(false);

        javax.swing.GroupLayout jpnlStep3Layout = new javax.swing.GroupLayout(jpnlStep3);
        jpnlStep3.setLayout(jpnlStep3Layout);
        jpnlStep3Layout.setHorizontalGroup(
            jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addGroup(jpnlStep3Layout.createSequentialGroup()
                        .addGroup(jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jcboCategory, 0, 293, Short.MAX_VALUE)
                            .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
                            .addComponent(jcboSubCategory, 0, 293, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jpnlStep3Layout.setVerticalGroup(
            jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addGap(18, 18, 18)
                .addGroup(jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jcboCategory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnlStep3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jcboSubCategory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(127, Short.MAX_VALUE))
        );

        jpnlContainer.add(jpnlStep3, "card3");

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel12.setText("Step 3. Select Cities");

        javax.swing.GroupLayout jpnlStep4Layout = new javax.swing.GroupLayout(jpnlStep4);
        jpnlStep4.setLayout(jpnlStep4Layout);
        jpnlStep4Layout.setHorizontalGroup(
            jpnlStep4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnlStep4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jspTreeContainer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE))
                .addContainerGap())
        );
        jpnlStep4Layout.setVerticalGroup(
            jpnlStep4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jspTreeContainer, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
                .addGap(12, 12, 12))
        );

        jpnlContainer.add(jpnlStep4, "card6");

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel13.setText("Finished!");

        jTextArea2.setBackground(new java.awt.Color(240, 240, 240));
        jTextArea2.setColumns(20);
        jTextArea2.setFont(new java.awt.Font("Tahoma", 0, 11));
        jTextArea2.setLineWrap(true);
        jTextArea2.setRows(5);
        jTextArea2.setTabSize(4);
        jTextArea2.setText("I have gathered all the information I need for a Single search.  You may add more single searches to a Group search.  The more you add, the more powerful your search will be!");
        jTextArea2.setWrapStyleWord(true);
        jTextArea2.setBorder(null);
        jTextArea2.setMinimumSize(new java.awt.Dimension(80, 14));
        jTextArea2.setPreferredSize(new java.awt.Dimension(80, 70));

        javax.swing.GroupLayout jpnlStep5Layout = new javax.swing.GroupLayout(jpnlStep5);
        jpnlStep5.setLayout(jpnlStep5Layout);
        jpnlStep5Layout.setHorizontalGroup(
            jpnlStep5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addContainerGap(410, Short.MAX_VALUE))
            .addGroup(jpnlStep5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jpnlStep5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jTextArea2, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jpnlStep5Layout.setVerticalGroup(
            jpnlStep5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnlStep5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addContainerGap(241, Short.MAX_VALUE))
            .addGroup(jpnlStep5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpnlStep5Layout.createSequentialGroup()
                    .addContainerGap(41, Short.MAX_VALUE)
                    .addComponent(jTextArea2, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );

        jpnlContainer.add(jpnlStep5, "card7");

        getContentPane().add(jpnlContainer, java.awt.BorderLayout.CENTER);

        jpnlNavigation.setPreferredSize(new java.awt.Dimension(400, 34));
        jpnlNavigation.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        jbtnPrevious.setText("<  Previous");
        jbtnPrevious.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jbtnPreviousMouseClicked(evt);
            }
        });
        jpnlNavigation.add(jbtnPrevious);

        jbtnNext.setText("Next  >");
        jbtnNext.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jbtnNextMouseClicked(evt);
            }
        });
        jpnlNavigation.add(jbtnNext);

        jbtnFinish.setText("Finish");
        jbtnFinish.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jbtnFinishMouseClicked(evt);
            }
        });
        jpnlNavigation.add(jbtnFinish);

        jbtnCancel.setText("Cancel");
        jbtnCancel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jbtnCancelMouseClicked(evt);
            }
        });
        jpnlNavigation.add(jbtnCancel);

        getContentPane().add(jpnlNavigation, java.awt.BorderLayout.PAGE_END);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
    // <editor-fold defaultstate="collapsed" desc="Events">
private void jbtnNextMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtnNextMouseClicked
    this.nextStep();
}//GEN-LAST:event_jbtnNextMouseClicked

private void jbtnPreviousMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtnPreviousMouseClicked
    this.previousStep();
}//GEN-LAST:event_jbtnPreviousMouseClicked

private void jbtnCancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtnCancelMouseClicked
    this.setVisible(false);
}//GEN-LAST:event_jbtnCancelMouseClicked

private void jcboCategoryItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcboCategoryItemStateChanged
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        this.jcboSubCategory.setEnabled(true);
        DefaultComboBoxModel cboModel = (DefaultComboBoxModel)this.jcboSubCategory.getModel();
        cboModel.removeAllElements();
        // Load sub categories
        final String category = (String)this.jcboCategory.getSelectedItem();
        String[] subCategories = this.ioController.getCLSubCategories(category);
        Arrays.sort(subCategories, new Comparator() {
            public int compare(Object a, Object b) {
                if (a.toString().contains("all " + category)) return -1;
                if (b.toString().contains("all " + category)) return 1;
                return a.toString().compareTo(b.toString());
            }
        });
        for (int i = 0; i < subCategories.length; i++) {
            cboModel.addElement(subCategories[i]);
        }
    }
}//GEN-LAST:event_jcboCategoryItemStateChanged

private void jbtnFinishMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtnFinishMouseClicked
    TreePath[] treePaths = this.checkboxTree.getCheckingPaths();
    // Loop through all, if no children its a city node
    // create list of cities and urls?  just keep cities and create a lookup function?
    this.setVisible(false);
}//GEN-LAST:event_jbtnFinishMouseClicked
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">

/** Assigns the IOController to this form */
public void setIOController(IOController ioController) {
    this.ioController = ioController;
}

/** Moves forward in the wizard */
private void nextStep() {
    switch (this.currentStep) {
        case 0:
            this.jpnlStart.setVisible(false);
            this.jpnlStep1.setVisible(true);
            this.currentStep = 1;
            break;
        case 1:
            // Hide previous step
            this.jpnlStep1.setVisible(false);
            if (this.jcboSearchType.getSelectedItem() == "Single") {
                this.jpnlStep3.setVisible(true);
                // Load the categories
                if (this.jcboCategory.getItemCount() == 0) {
                    String[] categories = this.ioController.getCLCategories();
                    Arrays.sort(categories);
                    for (int i = 0; i < categories.length; i++) {
                        this.jcboCategory.addItem(categories[i]);
                    }
                }
                this.currentStep = 3;
            }
            else {
                this.jpnlStep2.setVisible(true);
                this.jbtnNext.setVisible(false);
                this.jbtnFinish.setVisible(true);
                this.currentStep = 2;
            }
            break;
        case 2:
            // Not available
            break;
        case 3:
            // Hide previous step
            this.jpnlStep3.setVisible(false);
            // Show next step
            this.jpnlStep4.setVisible(true);
            // Load city data
            this.checkboxTree = new CheckboxTree(this.ioController.getCLCities());
            this.jspTreeContainer.setViewportView(this.checkboxTree);
            this.currentStep = 4;
            break;
        case 4:
            this.jpnlStep4.setVisible(false);
            this.jpnlStep5.setVisible(true);
            this.jbtnNext.setVisible(false);
            this.jbtnFinish.setVisible(true);
            this.currentStep = 5;
            break;
        case 5:
            // Not available
            break;
    }
}

/** Moves backwards in the wizard */
private void previousStep() {
    switch (this.currentStep) {
        case 1:
            this.jpnlStep1.setVisible(false);
            this.jpnlStart.setVisible(true);
            this.currentStep = 0;
            break;
        case 2:
            this.jpnlStep2.setVisible(false);
            this.jpnlStep1.setVisible(true);
            this.jbtnNext.setVisible(true);
            this.jbtnFinish.setVisible(false);
            this.currentStep = 1;
            break;
        case 3:
            this.jpnlStep3.setVisible(false);
            this.jpnlStep1.setVisible(true);
            this.currentStep = 1;
            break;
        case 4:
            this.jpnlStep4.setVisible(false);
            this.jpnlStep3.setVisible(true);
            this.currentStep = 3;
            break;
        case 5:
            this.jpnlStep5.setVisible(false);
            this.jpnlStep4.setVisible(true);
            this.jbtnNext.setVisible(true);
            this.jbtnFinish.setVisible(false);
            this.currentStep = 4;
            break;
    }
}
    // </editor-fold>

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JButton jbtnCancel;
    private javax.swing.JButton jbtnFinish;
    private javax.swing.JButton jbtnNext;
    private javax.swing.JButton jbtnPrevious;
    private javax.swing.JComboBox jcboCategory;
    private javax.swing.JComboBox jcboSearchType;
    private javax.swing.JComboBox jcboSubCategory;
    private javax.swing.JPanel jpnlContainer;
    private javax.swing.JPanel jpnlNavigation;
    private javax.swing.JPanel jpnlStart;
    private javax.swing.JPanel jpnlStep1;
    private javax.swing.JPanel jpnlStep2;
    private javax.swing.JPanel jpnlStep3;
    private javax.swing.JPanel jpnlStep4;
    private javax.swing.JPanel jpnlStep5;
    private javax.swing.JScrollPane jspTreeContainer;
    // End of variables declaration//GEN-END:variables
}
